//
//  YJHeaderController.m
//  SnackCourier
//
//  Created by qianfeng01 on 15/7/21.
//  Copyright (c) 2015年 qianfeng01. All rights reserved.
//

#import "YJHeaderController.h"
#import "AFNetworking.h"
#import "UMSocial.h"

@interface YJHeaderController ()<UMSocialUIDelegate,UIWebViewDelegate>

@property (nonatomic,strong) UIWebView *webView;


@end

@implementation YJHeaderController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createNavigationItem];
    [self createWebView];
    
}

-(void)createWebView{
    
    NSString *str=@"零点食客,为你挑选不一样的零食";
    NSMutableAttributedString *attstr = [[NSMutableAttributedString alloc] initWithString:str];
    [attstr addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(0,5)];
    [attstr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(6,5)];
    [attstr addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(12,3)];
    [attstr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial-BoldItalicMT" size:20.0] range:NSMakeRange(0,5)];
    [attstr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Bold" size:20.0] range:NSMakeRange(6, 5)];
    [attstr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Courier-BoldOblique" size:20.0] range:NSMakeRange(12, 3)];
    
    self.webView =[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, kScreenSize.width, kScreenSize.height-64)];
    self.webView.scrollView.bounces =NO;
    self.webView.scrollView.showsVerticalScrollIndicator=NO;
    if (!self.id) {
    UILabel *label =[[UILabel alloc] initWithFrame:CGRectMake(0, self.webView.frame.size.height-100, self.webView.frame.size.width, 55)];
    label.backgroundColor=[UIColor brownColor];
    label.attributedText=attstr;
    label.textAlignment=NSTextAlignmentCenter;
    [self.webView addSubview:label];
    }
    
    
    NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:self.linkUrl]];
    [self.webView loadRequest:request];
    self.webView.delegate =self;
    [self.view addSubview:self.webView];
}

-(BOOL)isDirectShareInIconActionSheet{
    return YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
